const mongoose = require('mongoose');
const OrderSchema = new mongoose.Schema({
  product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product' },
  totalFee: { type: Number },
  code_url: { type: String },
  orderStatus: { type: String }
}, { timestamps: true })

OrderSchema.virtual('id').get(function () {
  return this._id.toHexString()
})

OrderSchema.set('toObject', {
  virtuals: true
})

OrderSchema.set('toJSON', {
  virtuals: true
})

const Order = mongoose.model('Order', OrderSchema)
module.exports = Order;